package com.example;

import com.example.controller.BookController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class Application {

    public static void main(String[] args) {

//        我们可以设置arg属性  来给springboot 的 application设置临时属性比如端口号等  当然也可以不传参数
        String[] arg = new String [1];
        arg[0]= "--server.port=8082";
//        传参数
//        ConfigurableApplicationContext run = SpringApplication.run(Application.class, arg);
//        不传参数
        ConfigurableApplicationContext run = SpringApplication.run(Application.class);
        BookController bean = run.getBean(BookController.class);
        System.out.println(bean);
        System.out.println("===============");
        System.out.println(run.getBean(User.class));
    }

}
